<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
 <%@ taglib prefix="s" uri="/struts-tags" %>
 <%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sj:head jqueryui="true"/>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<SCRIPT type="text/javascript">
//document.getElementById("hiddebButton").style.display="none";
//document.getElementById("hiddebButtonYard").style.display="none";

function fnShowKeyBins() {
	document.forms["showKeyBinForm"].action = 'manageKeyBin';
	document.forms["showKeyBinForm"].submit(); 
}
</SCRIPT>
</head>
<body>
<sj:div id="keyBinDiv" name = "keyBinDiv" cssClass="maincontent" indicator="indicator">
<s:form name = "showKeyBinForm" id ="showKeyBinForm" theme="simple">

<table>
	<tr>
	<td width="10%">Select OEM :</td>
<td width="20%">
<s:select id = "oemType" name="oemType" list="oemList" listKey="oemId"
						listValue="oemName" headerKey="0" headerValue="Select OEM"
						onchange="$.publish('oemSelectedTopic')" >
						</s:select>
						<s:url var="populateYardUrl" action="ajaxAllocateYardKeyBin" ></s:url>
		
			<sj:div id = "hiddebButtonYard" cssStyle="display:none;">
				<sj:submit  formIds="showKeyBinForm"  href = "%{populateYardUrl}" listenTopics="oemSelectedTopic" targets="keyBinDiv"></sj:submit>
			</sj:div>
</td>
		<td width="10%">
		Select Yard :
		</td> 
		<td width="20%">
		<s:select label="Select Yard" headerKey="-1"
			headerValue="Select Yard" list="listYard" listKey="id"
			listValue="name" name="selectedYardId" onchange="$.publish('submitKeyBinTopic')" />

			<s:url var="populateYardUrl" action="populateYard" ></s:url>
		
			<sj:div id = "hiddebButton" cssStyle="display:none;">
				<sj:submit  formIds="showKeyBinForm"  href = "%{populateYardUrl}" listenTopics="submitKeyBinTopic" targets="keyBinDiv"></sj:submit>
			</sj:div>
		</td>
		<td width="65%"></td>
		<td align="right">
		<s:url var="populateKeyBinUrl" action="manageKeyBin" escapeAmp="false">
		 <s:param name="yardId" value="%{selectedYardId}"/>
		  <s:param name="oemId" value="%{oemType}"/></s:url>
		
			<sj:submit name= "Clink" href="%{populateKeyBinUrl}"  targets="keyBinDiv"  value="Create Key Bin"
			cssClass="btnbg"></sj:submit>
		</td>
		
		<!--<td align="right">
		<s:url var="exportKeyBinToExcelUrl" action="exportKeyBinToExcel" >
		 <s:param name="selectedYardId" value="%{selectedYardId}"/></s:url>
			<s:a name= "Click" href="%{exportKeyBinToExcelUrl}" value="Export Key Bin" cssClass="btnbg"></s:a>
		</td>
		
	--></tr>
	<!--<tr>
	<td align="right">
			<s:file name="keyBinUploadFile" label="Key Bins" theme="simple" value="KeyBin File" disabled="%{isSectionNotSelected}"/>
   	 	
    		<sj:submit href = "keyBinUpload.action" value="UploadKeyBin" name = "UploadKeyBin" formIds="showKeyBinForm" targets="keyBinDiv" disabled="%{isSectionNotSelected}"/>
	</td>
	</tr>
--></table>
  <table border="1" width="100%" >
  <tr bgcolor="#038040" >
  <td>
 KeyBinName
  </td>
  <td>
  KeyBinNumber
 
  </td>
  <td>
  Active

  </td>
  <td>
  KeyOccupied
 
  </td>
   <td>
  Capacity
 
  </td>
  </tr>

 <s:iterator value="listKeyBins" status="status">
  <tr >
  <td>
	<s:url action="manageKeyBin" id="secName" escapeAmp="false">
   <s:param name="keyBinId" value="%{keyBinId}"/>
   <s:param name="yardId" value="%{selectedYardId}"/>
   <s:param name="oemId" value="%{oemType}"/>
  </s:url>
  
  <sj:a href="%{secName}" targets="keyBinDiv" formIds="showKeyBinForm"><s:property value="KeyBinName" /></sj:a>
 

    </td>
  <td>
  <s:textfield  name= "listKeyBins.keyBinNumber" value ='%{keyBinNumber}'></s:textfield>
  </td>
  <td>
  <s:checkbox  name= "listKeyBins.active"   value ='%{active}' ></s:checkbox>
  </td>
  <td>
  <s:checkbox  name= "listKeyBins.keyOccupied"   value ='%{keyOccupied}' ></s:checkbox>
  </td>
  <td>
  <s:textfield name= "listKeyBins.capacity" value ='%{capacity}'></s:textfield>
  </td>
 
  </tr>
  </s:iterator>
  
  

  
  </table>


</s:form>
</sj:div>
</body>
</html>